//
//  PGLoginWithRegisterViewController.m
//  youqu
//
//  Created by 彭鹏 on 16/9/24.
//  Copyright © 2016年 pengpeng. All rights reserved.
//

#import "PGLoginWithRegisterViewController.h"
#import "PGLoginWithRegisterView.h"
#import "PGFastLoginView.h"

@interface PGLoginWithRegisterViewController ()
@property (strong, nonatomic) IBOutlet UIView *middleView;

@property (weak, nonatomic) IBOutlet UIView *bottomView;

@property (strong, nonatomic) IBOutlet NSLayoutConstraint *leadConstraint;

@end

@implementation PGLoginWithRegisterViewController
- (IBAction)close {
    
    [self dismissViewControllerAnimated:YES completion:nil];
}

- (IBAction)registerBtn:(UIButton *)btn {
    btn.selected = !btn.selected;

//    if (btn.isSelected) {
//        
//        _leadConstraint.constant = -SCREENW;
//    }else {
//        _leadConstraint.constant = 0;
//    }
    
    _leadConstraint.constant = btn.isSelected?-SCREENW:0;
    
    [UIView animateWithDuration:0.25 animations:^{
        [self.view layoutIfNeeded];
    }];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    UITextField *textField = [[UITextField alloc] init];
    textField.text =  @"1111";
    textField.placeholder = @"222";
    NSLog(@"%@",textField);
    
    NSLog(@"%@",[textField valueForKeyPath:@"placeholderLabel.textColor"]);
    
    
    
    [self addLoginView];
    
    [self addRegisterView];
    
    [self addFastLoginView];
    
    
}

- (void)addLoginView {
    PGLoginWithRegisterView *loginView = [PGLoginWithRegisterView loadLoginView];
    loginView.frame = CGRectMake(0, 0, self.middleView.pg_width*0.5, self.middleView.pg_height);
    [self.middleView addSubview:loginView
     ];
}

- (void)addRegisterView {
    PGLoginWithRegisterView *registerView = [PGLoginWithRegisterView loadRegisterView];
    registerView.frame = CGRectMake(SCREENW, 0, self.middleView.pg_width*0.5, self.middleView.pg_height);
    [self.middleView addSubview:registerView];
}

- (void)addFastLoginView {
    PGFastLoginView *fastLoginView = [PGFastLoginView loadFastLoginView];
    fastLoginView.frame = CGRectMake(0, 0, self.bottomView.pg_width, self.bottomView.pg_height);
    [self.bottomView addSubview:fastLoginView];
}


- (UIStatusBarStyle)preferredStatusBarStyle {
    return UIStatusBarStyleLightContent;
}




@end
